package com.cskaoyan;

import com.aliyuncs.CommonRequest;
import com.aliyuncs.CommonResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;

/**
 * @description：
 * @author: 曹旭
 * @date: 2022/5/11 10:53
 */
public class Test {
    public static void main(String[] args) {
        DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", "LTAI5t8gpxPTCR6W58RnZq4u", "mVPbpbxia0JQotb7HyJAREV8QUuq8h");
        IAcsClient client = new DefaultAcsClient(profile);

        CommonRequest commonRequest = new CommonRequest();
        commonRequest.setMethod(MethodType.POST);
        commonRequest.setDomain("dysmsapi.aliyuncs.com");
        commonRequest.setVersion("2017-05-25");
        commonRequest.setAction("SendSms");
        commonRequest.putQueryParameter("RegionId","cn-hangzhou");
        commonRequest.putQueryParameter("PhoneNumbers","13776111711");
        commonRequest.putQueryParameter("SignName","stone4j");
        commonRequest.putQueryParameter("TemplateCode","SMS_173765187");
        commonRequest.putQueryParameter("TemplateParam","{\"code\":\"65536\"}");

        try {
            CommonResponse response = client.getCommonResponse(commonRequest);
            System.out.println(response.getData());
        } catch (ClientException e) {
            e.printStackTrace();
        }
    }
}
